'\" te
.\"  Copyright (c) 2001 Sun Microsystems, Inc. - All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH DU 1B "Jun 5, 2001"
.SH NAME
du \- display the number of disk blocks used per directory or file
.SH SYNOPSIS
.LP
.nf
\fB/usr/ucb/du\fR [\fB-adkLr\fR] [\fB-o\fR | \fB-s\fR] [\fIfilename\fR]
.fi

.SH DESCRIPTION
.sp
.LP
The \fBdu\fR utility gives the number of kilobytes contained in all files and,
recursively, directories within each specified directory or file
\fIfilename\fR. If \fIfilename\fR is missing, `\fB\&.\fR' (the current
directory) is used.
.sp
.LP
A file that has multiple links to it is only counted once.
.SH OPTIONS
.sp
.LP
The following options are supported:
.sp
.ne 2
.na
\fB\fB-a\fR\fR
.ad
.RS 6n
Generates an entry for each file.
.RE

.sp
.ne 2
.na
\fB\fB-d\fR\fR
.ad
.RS 6n
Does not cross file system boundaries. For example, \fBdu\fR \fB-d\fR \fB/\fR
reports usage only on the root partition.
.RE

.sp
.ne 2
.na
\fB\fB-k\fR\fR
.ad
.RS 6n
Writes the files sizes in units of 1024  bytes, rather than the default
512-byte units.
.RE

.sp
.ne 2
.na
\fB\fB-L\fR\fR
.ad
.RS 6n
Processes symbolic links by using the file or directory that the symbolic link
references, rather than the link itself.
.RE

.sp
.ne 2
.na
\fB\fB-o\fR\fR
.ad
.RS 6n
Does not add child directories' usage to a parent's total. Without this option,
the usage listed for a particular directory is the space taken by the files in
that directory, as well as the files in all directories beneath it. This option
does nothing if the \fB-s\fR option is used.
.RE

.sp
.ne 2
.na
\fB\fB-r\fR\fR
.ad
.RS 6n
Generates messages about directories that cannot be read, files that cannot be
opened, and so forth, rather than being silent (the default).
.RE

.sp
.ne 2
.na
\fB\fB-s\fR\fR
.ad
.RS 6n
Only displays the grand total for each of the specified \fIfilename\fRs.
.RE

.sp
.LP
Entries are generated only for each directory in the absence of options.
.SH EXAMPLES
.LP
\fBExample 1 \fRShowing usage of all subdirectories in a directory
.sp
.LP
This example uses \fBdu\fR in a directory. The \fBpwd\fR(1) command was used to
identify the directory, then \fBdu\fR was used to show the usage of all the
subdirectories in that directory. The grand total for the directory is the last
entry in the display:

.sp
.in +2
.nf
example% \fBpwd\fR
/usr/ralph/misc
example% \fBdu\fR
5      ./jokes
33     ./squash
44     ./tech.papers/lpr.document
217    ./tech.papers/new.manager
401    ./tech.papers
144    ./memos
80     ./letters
388    ./window
93     ./messages
15     ./useful.news
1211   .
.fi
.in -2
.sp

.SH ENVIRONMENT VARIABLES
.sp
.LP
If any of the \fBLC_*\fR variables, that is, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR,
\fBLC_TIME\fR, \fBLC_COLLATE\fR, \fBLC_NUMERIC\fR, and \fBLC_MONETARY\fR (see
\fBenviron\fR(7)), are not set in the environment, the operational behavior of
\fBdu\fR for each corresponding locale category is determined by the value of
the \fBLANG\fR environment variable. If \fBLC_ALL\fR is set, its contents are
used to override both the \fBLANG\fR and the other \fBLC_*\fR variables. If
none of the above variables is set in the environment, the "C" (U.S. style)
locale determines how \fBdu\fR behaves.
.sp
.ne 2
.na
\fB\fBLC_CTYPE\fR\fR
.ad
.RS 15n
Determines how  \fBdu\fR handles characters. When \fBLC_CTYPE\fR is set to a
valid value, \fBdu\fR can display and handle text and filenames containing
valid characters for that locale. \fBdu\fR can display and handle Extended Unix
Code (EUC) characters where any individual character can be 1, 2, or 3 bytes
wide. \fBdu\fR can also handle EUC characters of 1, 2, or more column widths.
In the "C" locale, only characters from ISO 8859-1 are valid.
.RE

.sp
.ne 2
.na
\fB\fBLC_MESSAGES\fR\fR
.ad
.RS 15n
Determines how diagnostic and informative messages are presented. This includes
the language and style of the messages, and the correct form of affirmative and
negative responses.  In the "C" locale, the messages are presented in the
default form found in the program itself (in most cases, U.S. English).
.RE

.SH SEE ALSO
.sp
.LP
.BR du (1),
.BR pwd (1),
.BR attributes (7),
.BR environ (7),
.BR df (8),
.BR quot (8)
.SH NOTES
.sp
.LP
Filename arguments that are not directory names are ignored, unless you use
\fB-a\fR.
.sp
.LP
If there are too many distinct linked files, \fBdu\fR will count the excess
files more than once.
